package com.muchfish.dao;

import com.muchfish.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;
@CacheNamespaceRef(IUserDao.class)
//@CacheNamespace
public interface IUserDao {

    public User findById(Integer id);

    public List<User> findAllUserAndRole();


    //<!--    注解和xml混合使用命中同一个statementId会报错：Error parsing SQL Mapper Configuration. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for com.muchfish.dao.IUserDao.findUserById. please check com/muchfish/dao/IUserDao.xml and com/muchfish/dao/IUserDao.java (best guess)-->
    //根据id查询用户
    @Select({"select * from user where id = #{id}"})
    @Options(useCache = true)
    public User findUserById(Integer id);

    //更新用户
    @Update("update user set username = #{username} where id = #{id}")
    public void updateUserByUserId(User user);

}
